<include file='Common:head'/>
<form id="upForm" method="get">
<div class="select_role_box">
	<div class="customer">選擇加入的店</div>
	<select class="select_shop">
	<option serverId="-1">---------請選擇-------</option>
	<foreach name='list' item='vo'>
		<option serverId="{$vo.id}">{$vo.name}</option>
	</foreach>
	</select>
	<input type="hidden" class="serverId" />
	<div class="add_washer" style="background-color:#1A8CFF;">確認</div>
	<p>*選擇后不可更改，請慎重選擇！</p>
</div>
</form>
<script type="text/javascript">
/* onclick="window.location.href = '{:U(MODULE_NAME.'/server/update_server_info',array('type'=>'staff'))}';" */
$('.select_shop').change(function(){
	var serverId = $(this).find("option:selected").attr('serverId');
	$('.serverId').val(serverId);
});
$('.add_washer').click(function(){
	var serverId = $('.serverId').val();
	var type = 'staff';
	var data = {serverId : serverId , type : type};
	$.ajax({
		data : data,
		url : "{:U(MODULE_NAME.'/server/update_server_info')}",
		type:"get",
		dataType: "json",
		success: function (returndata) {
			if(returndata.status==1){
   		 		layer.open({
	 				style:'font-size:3rem;',
	 				content:returndata.info,
	 				time:2,
	 				end:function(){
						window.location.href = "{:U(MODULE_NAME.'/server/staff_wait')}";
			 		}
 				});
   	 		}else{
	   	 		layer.open({
	 				style:'font-size:3rem;',
	 				content:returndata.info,
	 				time:2,
	 				end:function(){
						window.location.href = "{:U(MODULE_NAME.'/server/staff_wait')}";
			 		}
				});
   	 		}
        }
	})
});

$(document).ready(function(){
	$('title').html('選擇成為的角色');
	$('.header .title').html("選擇成為的角色");
	$('.header .right').html('');
});
</script>